package com.users.rn.kit

import android.content.Context
import android.content.Intent
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.users.rn.common.cmbroadcast.RNBridgeModuleName

/**

 * 作者：wolf on 1/17/21 16:54

 * 邮箱：bluce

 */

object RNKITTools {

    /**
     * 发送广播
     * @param context 上下文
     * @param eventName 名称
     * @param content 参数
     */
    fun sendBroadcast(context: Context, eventName: String, content: String) {
        val intent = Intent(RNBridgeModuleName.RN_JS_BROADCAST)
        intent.putExtra(RNBridgeModuleName.RN_JS_BROADCAST_FILTER_NAME, eventName)
        intent.putExtra(RNBridgeModuleName.RN_JS_BROADCAST_CONTENT, content)
        LocalBroadcastManager.getInstance(context.applicationContext).sendBroadcast(intent)
    }
}